<template>
	<view class="container">
		<view class="head">
			<u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" title="个人中心"
				:background="{ background: 'transprent' }" title-color="#FFFFFF">
				<!-- <view @click="$u.func.route('/pages/system/setting')" slot="right">
					<image src="/static/images/user/setting.png" class="set-icon" mode="widthFix"></image>
				</view> -->
			</u-navbar>
			<view class="head-bg">

			</view>
			<!-- <image src="/static/images/user/bg.png" class="head-bg" /> -->

			<!-- 用户信息 -->
			<view class="user-box">
				<image :src="userInfo.avatar" class="avatar" mode=""></image>
				<view class="left">
					<view class="user-name">{{ userInfo.nick_name }}</view>
					<view class="user-phone">{{ userInfo.user_name }}</view>
				</view>
				<!-- <view @click="$u.func.route('/pages/user/profile')" class="edit-btn">编辑资料</view> -->
			</view>
			<!-- 操作按钮 -->
			<!-- <view class="nav">
				<navigator url="" hover-class="none" class="nav-item">
					<image src="/static/images/user/n1.png" class="icon" mode=""></image>
					<view class="name">我的消息</view>
				</navigator>
				<navigator url="" hover-class="none" class="nav-item">
					<image src="/static/images/user/n2.png" class="icon" mode=""></image>
					<view class="name">我的待办</view>
				</navigator>
				<navigator url="" hover-class="none" class="nav-item">
					<image src="/static/images/user/n3.png" class="icon" mode=""></image>
					<view class="name">我的地址</view>
				</navigator>
				<navigator url="" hover-class="none" class="nav-item">
					<image src="/static/images/user/n4.png" class="icon" mode=""></image>
					<view class="name">我的收藏</view>
				</navigator>
			</view> -->
			<view class="role_name">角色：{{userInfo.role_name === 'carrier' ? '承运商' : '司机'}}</view>
		</view>
		<!-- 功能列表 -->
		<view class="cell-box">
			<u-cell-group :border="false">
				<u-cell-item title="账号安全" @click="jump('./my')">
					<image slot="icon" src="/static/images/user/security.png" class="icon" mode=""></image>
				</u-cell-item>
				<u-cell-item title="版本号" value="Verson 0.0.1" :arrow="false">
					<image slot="icon" src="/static/images/user/i.png" class="icon" mode=""></image>
				</u-cell-item>
			</u-cell-group>
		</view>
		<u-button :custom-style="{width:'400rpx',position:'fixed',bottom:'60rpx',left:'175rpx'}" @click="signOut">退出登录
		</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		onLoad() {
			console.log(this.userInfo)
		},
		methods: {
			jump(url) {
				uni.navigateTo({
					url: url
				})
			},
			signOut() {
				this.$u.func.logout()
			}
		}
	};
</script>

<style lang="scss">
	.container {
		background-color: #f7f7f7;
		min-height: 100vh;
		overflow: hidden;
	}

	.head {
		position: relative;
		top: 0;
		left: 0;
		z-index: 1;
		min-height: 400rpx;
		overflow: hidden;
		background: $uni-color-primary;

		.set-icon {
			vertical-align: middle;
			width: 41rpx;
			height: auto;
			margin-right: 35rpx;
		}

		.head-bg {
			position: absolute;
			left: 0px;
			top: 0px;
			z-index: -1;
			width: 750rpx;
			height: 400rpx;
			background: $uni-color-primary;
		}
	}

	.user-box {
		display: flex;
		justify-content: flex-start;
		padding: 0 20rpx 0 40rpx;
		margin-top: 36rpx;

		.avatar {
			width: 100rpx;
			height: 100rpx;
			background: #ffffff;
			border-radius: 50%;
		}

		.left {
			display: flex;
			flex-direction: column;
			align-items: flex-start;
			margin-left: 20rpx;
			height: 100rpx;
			justify-content: space-around;

			.user-name {
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #ffffff;
			}

			.user-phone {
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: 600;
				color: #ffffff;
			}
		}

		.edit-btn {
			margin-top: 20rpx;
			flex-shrink: 0;
			display: flex;
			justify-content: center;
			align-items: center;

			width: 165rpx;
			height: 54rpx;
			border: 2rpx solid #f5f5f5;
			border-radius: 11rpx;

			font-size: 27rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #ffffff;
		}
	}

	.role_name {
		font-size: 26rpx;
		color: #ffffff;
		line-height: 52rpx;
		width: 100%;
		padding-right: 20rpx;
		box-sizing: border-box;
		text-align: right;
		margin-top: 60rpx;
	}

	.nav {
		display: flex;
		//border-top: 2rpx solid #7dcdd6;
		margin: 36rpx 38rpx 0;
		padding: 36rpx 0 42rpx;

		.nav-item {
			width: calc(100% / 4);
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-between;

			font-size: 25rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #ffffff;

			&:not(:last-of-type) {
				position: relative;

				&::after {
					position: absolute;
					right: 0;
					top: 50%;
					transform: translateY(-50%);
					content: '';
					display: block;
					width: 2rpx;
					background-color: #3ac4d1;
					height: 30rpx;
				}
			}

			.icon {
				width: 48rpx;
				height: 48rpx;
				margin-bottom: 6rpx;
			}
		}
	}

	.cell-box {
		background: #ffffff;
		margin: 18rpx;

		.icon {
			width: 32rpx;
			height: 32rpx;
			margin-right: 22rpx;
		}
	}
</style>
